Skip to content

发放指定批次的消费金

商户平台/API完成制券/消费金后,可使用发放代金券接口发券/消费金。通过调用此接口可发放指定批次给指定用户。

请求参数类型描述
openidstring用户OpenID
jsonobject声明请求的JSON数据结构
stock_idstring批次号
out_request_nostring商户单据号
user_namestring用户姓名
id_card_numberstring身份证号码
amountnumber发放面额
appidstring公众账号ID
card_typestring证件类型
headersobject声明请求的头参数
Wechatpay-Serialstring平台公钥ID/平台公钥证书序列号
php
$instance->v3->multiuse->users->_openid_->coupons->postAsync([
  'openid' => '',
  'json' => [
    'stock_id' => '9856000',
    'out_request_no' => '8956000202407191254642',
    'user_name' => '757b340b45ebef5467rter35gf464344v3542sdf4t6re4tb4f54ty45t4yyry45',
    'id_card_number' => '757b340b45ebef5467rter35gf464344v3542sdf4t6re4tb4f54ty45t4yyry45',
    'amount' => 10000,
    'appid' => 'wx233544546545989',
    'card_type' => 'ID_CARD',
  ],
  'headers' => [
    'Wechatpay-Serial' => 'PUB_KEY_ID_0114232134912410000000000000',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$instance->chain('v3/multiuse/users/{openid}/coupons')->postAsync([
  'openid' => '',
  'json' => [
    'stock_id' => '9856000',
    'out_request_no' => '8956000202407191254642',
    'user_name' => '757b340b45ebef5467rter35gf464344v3542sdf4t6re4tb4f54ty45t4yyry45',
    'id_card_number' => '757b340b45ebef5467rter35gf464344v3542sdf4t6re4tb4f54ty45t4yyry45',
    'amount' => 10000,
    'appid' => 'wx233544546545989',
    'card_type' => 'ID_CARD',
  ],
  'headers' => [
    'Wechatpay-Serial' => 'PUB_KEY_ID_0114232134912410000000000000',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$instance['v3/multiuse/users/{openid}/coupons']->postAsync([
  'openid' => '',
  'json' => [
    'stock_id' => '9856000',
    'out_request_no' => '8956000202407191254642',
    'user_name' => '757b340b45ebef5467rter35gf464344v3542sdf4t6re4tb4f54ty45t4yyry45',
    'id_card_number' => '757b340b45ebef5467rter35gf464344v3542sdf4t6re4tb4f54ty45t4yyry45',
    'amount' => 10000,
    'appid' => 'wx233544546545989',
    'card_type' => 'ID_CARD',
  ],
  'headers' => [
    'Wechatpay-Serial' => 'PUB_KEY_ID_0114232134912410000000000000',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$response = $instance->v3->multiuse->users->_openid_->coupons->post([
  'openid' => '',
  'json' => [
    'stock_id' => '9856000',
    'out_request_no' => '8956000202407191254642',
    'user_name' => '757b340b45ebef5467rter35gf464344v3542sdf4t6re4tb4f54ty45t4yyry45',
    'id_card_number' => '757b340b45ebef5467rter35gf464344v3542sdf4t6re4tb4f54ty45t4yyry45',
    'amount' => 10000,
    'appid' => 'wx233544546545989',
    'card_type' => 'ID_CARD',
  ],
  'headers' => [
    'Wechatpay-Serial' => 'PUB_KEY_ID_0114232134912410000000000000',
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance->chain('v3/multiuse/users/{openid}/coupons')->post([
  'openid' => '',
  'json' => [
    'stock_id' => '9856000',
    'out_request_no' => '8956000202407191254642',
    'user_name' => '757b340b45ebef5467rter35gf464344v3542sdf4t6re4tb4f54ty45t4yyry45',
    'id_card_number' => '757b340b45ebef5467rter35gf464344v3542sdf4t6re4tb4f54ty45t4yyry45',
    'amount' => 10000,
    'appid' => 'wx233544546545989',
    'card_type' => 'ID_CARD',
  ],
  'headers' => [
    'Wechatpay-Serial' => 'PUB_KEY_ID_0114232134912410000000000000',
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance['v3/multiuse/users/{openid}/coupons']->post([
  'openid' => '',
  'json' => [
    'stock_id' => '9856000',
    'out_request_no' => '8956000202407191254642',
    'user_name' => '757b340b45ebef5467rter35gf464344v3542sdf4t6re4tb4f54ty45t4yyry45',
    'id_card_number' => '757b340b45ebef5467rter35gf464344v3542sdf4t6re4tb4f54ty45t4yyry45',
    'amount' => 10000,
    'appid' => 'wx233544546545989',
    'card_type' => 'ID_CARD',
  ],
  'headers' => [
    'Wechatpay-Serial' => 'PUB_KEY_ID_0114232134912410000000000000',
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
返回字典类型描述
coupon_idstring消费金ID

参阅 官方文档

Published on the GitHub by TheNorthMemory